import { createSlice, configureStore } from "@reduxjs/toolkit";

export const adminSlice = createSlice({
  name: "loginAdmin",
  initialState: {
    admin: {},
  },
  reducers: {
    setAdmin(state, action) {
      state.admin = action.payload;
    },

    aa(state, action) {
      state.admin["name"] = "可莉";
      state.admin["photo"] = "卡哇伊";

      return state;
    },

    // setAdmin(state, action) {
    //   state.admin = action.payload;
    //   console.log(action);
    // },
  },
});
// export const mySlice = createSlice({
//   name: "myCount",
//   initialState: {
//     count: 0,
//   },
//   reducers: {
//     setCount(state, action) {
//       if (action.type === "add") {
//         return { count: state.count + 1 };
//       }
//       return state;
//     },
//   },
// });

export const store = configureStore({
  reducer: {
    adminSlice: adminSlice.reducer,
    // mySlice: mySlice.reducer,
  },
});
